
Page({
  onLoad() {
    /*
    wx.showToast({
      title: '成功',
      icon: 'loading',
      duration: 5000,
      mask: true
    })*/

    wx.getSystemInfo({
      success (res) {
        console.log(res)
      }
    })
  },
  showModel() {
    wx.showModal({
      title: '提示',
      content: '这是一个模态弹窗',
      showCancel: false,
      confirmText: 'ok',
      confirmColor: 'red',
      success (res) {
        if (res.confirm) {
          console.log('用户点击确定')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })
  },
  showActionSheet() {
    wx.showActionSheet({
      alertText: '请选择相应的操作',
      itemList: ['扫码', '生成二维码'],
      itemColor: 'red',
      success (res) {
        switch (res.tapIndex) {
          case 0:
            wx.scanCode({
              success (res) {
                console.log(res.result)
              },
              fail(res) {
                console.log(res)
              }
            })
            break
          case 1:
            wx.navigateTo({
              url: "/views/qrcode/index"
            })
            break
        }
      },
      fail (res) {
        console.log(res.errMsg)
      }
    })
  },
  payment() {

    /*
    ajax
    wx.request({
      success() {
        // 后端返回
        timeStamp: '',
        nonceStr: '',
        package: '',
        signType: 'MD5',
        paySign: '',

        wx.requestPayment({
          timeStamp: '',
          nonceStr: '',
          package: '',
          signType: 'MD5',
          paySign: '',
          success (res) {

          },
          fail (res) {
            console.log(res)
          }
        })
      }
    })*/
  },
  previewImage() {
    wx.previewImage({
      current: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png', // 当前显示图片的http链接
      urls: [
        'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
        'https://qr.api.cli.im/newqr/create?data=https%253A%252F%252Fwww.baidu.com%252F&level=H&transparent=false&bgcolor=%23FFFFFF&forecolor=%23EEB41F&blockpixel=12&marginblock=1&logourl=https%3A%2F%2Fmhimg.clewm.net%2Fcli%2Fimages%2Fbeautify%2Fnew%2Flogo%2F25.png&size=260&logo_shadow=1&logoshape=rect&embed_text_fontfamily=simhei.ttc&foretype=1&eye_use_fore=1&qrcode_eyes=one_round&outcolor=%23000000&incolor=%23000000&body_type=17&water_ratio=1&qr_rotate=0&text=&fontfamily=simhei.ttc&logow=150&logoh=auto&logo_pos=0&kid=bizcliim&time=1626921525&key=02efe3de74cdcff2abd6baace0ba4da0'
      ] // 需要预览的图片http链接列表
    })
  },
  chooseImages() {
    wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success (res) {
        // tempFilePath可以作为img标签的src属性显示图片
        const tempFilePaths = res.tempFilePaths
      }
    })
  },
  chooseLocation() {
    wx.chooseLocation({
      success(res) {
        console.log(res)
      }
    })
  }
})